package cn.coisini.model.common.enums;

import lombok.Getter;

/**
 * @author xiangshaw
 * Description: 通用的结果返回类
 */
@Getter
public enum ResultEnum {
    // 操作状态
    SUCCESS(200, "操作成功"),
    FAIL(201, "操作失败"),
    DATA_EXIST(202, "数据已存在"),
    DATA_NOT_EXIST(203, "数据不存在"),
    DATA_INVALID_PARAMETER(204, "数据参数错误"),
    DATA_UPDATE_FAILED(205, "数据更新失败"),
    DATA_DELETE_FAILED(206, "数据删除失败"),
    DATA_NOT_UPDATE(207, "数据未更新"),
    DATA_NOT_DELETE(208, "数据未删除"),
    DATA_NOT_ADD(209, "数据未添加"),
    PARAM_ERROR(210, "参数错误"),
    DATA_NOT_FOUND_BY_USERNAME(211, "用户未找到"),
    DATA_NOT_FOUND_BY_EMAIL(212, "邮箱未找到"),
    URL_GENERATION_FAILED(213, "URL生成失败"),


    // 登录状态
    LOGIN_USERNAME_ERROR(2, "用户名错误"),
    LOGIN_PASSWORD_ERROR(3, "密码错误"),
    LOGIN_USERNAME_OR_PASSWORD_ERROR(4, "用户名或密码错误"),
    LOGIN_SUCCESS(5, "登录成功"),
    LOGOUT_SUCCESS(6, "退出成功"),
    LOGIN_ERROR(7, "登录失败"),
    LOGIN_EXPIRED(8, "登录过期"),
    LOGIN_INVALID(9, "登录失效"),
    LOGIN_EXCEPTION(10, "登录异常"),

    // token状态
    TOKEN_EXPIRED (100, "Token过期"),
    TOKEN_INVALID (101, "Token无效"),
    TOKEN_ERROR (102, "Token错误"),
    TOKEN_LOST (103, "Token丢失"),
    TOKEN_EXCEPTION (106, "Token异常"),
    TOKEN_NOT_FOUND (107, "Token未找到"),


    REQUIRES_LOGIN(401, "需要登录后操作"),
    ACCESS_LIMIT(429, "访问过于频繁"),

    // 验证码状态
    SECURITY_CODE(504,"验证码不存在或已过期"),
    SECURITY_CODE_ERROR(505,"验证码错误"),

    // 文件状态
    FILE_UPLOAD_SUCCESS(1000, "文件上传成功"),
    FILE_UPLOAD_FAIL(1001, "文件上传失败"),
    FILE_DOWNLOAD_SUCCESS(1002, "文件下载成功"),
    FILE_DOWNLOAD_FAIL(1003, "文件下载失败"),
    FILE_DELETE_SUCCESS(1004, "文件删除成功"),
    FILE_DELETE_FAIL(1005, "文件删除失败"),
    FILE_NOT_FOUND(1006, "文件未找到"),

    // 权限状态
    NO_OPERATOR_AUTH(2000, "无权限操作"),
    NEED_ADMIND(2001, "需要管理员权限"),
    AUTHENTICATION_FAILED(2002, "认证失败"),

    // 日志记录
    LOG_ADD_SUCCESS(3000, "日志添加成功"),
    LOG_ADD_FAIL(3001, "日志添加失败"),
    LOG_DELETE_SUCCESS(3002, "日志删除成功"),
    LOG_DELETE_FAIL(3003, "日志删除失败"),
    LOG_UPDATE_SUCCESS(3004, "日志更新成功"),
    LOG_UPDATE_FAIL(3005, "日志更新失败"),
    LOG_QUERY_SUCCESS(3006, "日志查询成功"),
    LOG_QUERY_FAIL(3007, "日志查询失败");


    //通过get方法就可以拿值
    final int code;
    final String message;

    //触发构造器，赋值
    ResultEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

}

